<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">API或联登上下线信息</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{ctrlOneKeyOnlineInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form" rendered="#{ctrlOneKeyOnlineInfoBean.isView()}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{ctrlOneKeyOnlineInfoBean.onSave()}"
                                         update="@form" rendered="#{ctrlOneKeyOnlineInfoBean.isEdit()}"/>
                        <p:commandButton value="上线" icon="fa fa-arrow-up"
                                         actionListener="#{ctrlOneKeyOnlineInfoBean.online(ctrlOneKeyOnlineInfoBean.$.id)}"
                                         process="@this"
                                         update="@form" rendered="#{ctrlOneKeyOnlineInfoBean.$.status == 0}">
                            <p:confirm header="确定上线#{ctrlOneKeyOnlineInfoBean.$.partyName}？"
                                       message="#{ctrlOneKeyOnlineInfoBean.$.numType==1?'联登':'API'}序号：#{ctrlOneKeyOnlineInfoBean.$.numId}"/>
                        </p:commandButton>
                        <p:commandButton value="下线" icon="fa fa-arrow-down"
                                         actionListener="#{ctrlOneKeyOnlineInfoBean.offline(ctrlOneKeyOnlineInfoBean.$.id)}"
                                         process="@this"
                                         update="@form" rendered="#{ctrlOneKeyOnlineInfoBean.$.status == 1}">
                            <p:confirm header="确定下线#{ctrlOneKeyOnlineInfoBean.$.partyName}？"
                                       message="#{ctrlOneKeyOnlineInfoBean.$.numType==1?'联登':'API'}序号：#{ctrlOneKeyOnlineInfoBean.$.numId}"/>
                        </p:commandButton>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 ">
                    <div class="ui-g-12 card">
                        <h1>基础信息</h1>
                        <div class="ui-g-12">
                            <p:panelGrid style="width: 100%;text-align: center">
                                <p:row>
                                    <p:column style="font-weight: bold;">甲方名称</p:column>
                                    <p:column style="font-weight: bold;">序号类型</p:column>
                                    <p:column style="font-weight: bold;">序号ID</p:column>
                                    <p:column style="font-weight: bold;">模板ID</p:column>
                                    <p:column style="font-weight: bold;">当前状态</p:column>
                                </p:row>
                                <p:row>
                                    <p:column>
                                        <h:outputText value="#{ctrlOneKeyOnlineInfoBean.$.partyName}"/>
                                    </p:column>
                                    <p:column>
                                        <h:outputText value="联登" rendered="#{ctrlOneKeyOnlineInfoBean.$.numType == 1}"/>
                                        <h:outputText value="API" rendered="#{ctrlOneKeyOnlineInfoBean.$.numType == 2}"/>
                                    </p:column>
                                    <p:column>
                                        <h:outputText value="#{ctrlOneKeyOnlineInfoBean.$.numId}"/>
                                    </p:column>
                                    <p:column >
                                        <h:outputText value="#{ctrlOneKeyOnlineInfoBean.$.apiTemplateId}"/>
                                    </p:column>
                                    <p:column >
                                        <h:outputText value="已下线" style="color:red" rendered="#{ctrlOneKeyOnlineInfoBean.$.status == 0}"/>
                                        <h:outputText value="上线中" style="color:blue" rendered="#{ctrlOneKeyOnlineInfoBean.$.status == 1}"/>
                                    </p:column>
                                </p:row>
                            </p:panelGrid>
                        </div>

                        <div class="ui-g-12"></div>

                        <div class="ui-g-2">
                            <p:outputLabel value="控量下线量级"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText id="offlineCount" value="#{ctrlOneKeyOnlineInfoBean.$.offlineCount}"
                                disabled="#{ctrlOneKeyOnlineInfoBean.isView()}"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="控量模式"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu id="controlType" value="#{ctrlOneKeyOnlineInfoBean.$.controlType}"
                                             disabled="#{ctrlOneKeyOnlineInfoBean.isView()}">
                                <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                <f:selectItem itemLabel="提单" itemValue="1"/>
                                <f:selectItem itemLabel="推单" itemValue="2" />
                            </p:selectOneMenu>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="上线时间"/>
                        </div>
                        <div class="ui-g-4">
                            <p:calendar id="onlineTime" value="#{ctrlOneKeyOnlineInfoBean.$.onlineTime}"
                                        pattern="HH:mm:ss" timeOnly="true" disabled="#{ctrlOneKeyOnlineInfoBean.isView()}"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="下线时间"/>
                        </div>
                        <div class="ui-g-4">
                            <p:calendar id="offlineTime" value="#{ctrlOneKeyOnlineInfoBean.$.offlineTime}"
                                        pattern="HH:mm:ss" timeOnly="true" disabled="#{ctrlOneKeyOnlineInfoBean.isView()}" />
                        </div>
                    </div>
                </div>
            </div>
            <p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
                <p:commandButton value="确定" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                <p:commandButton value="取消" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
            </p:confirmDialog>
        </h:form>
    </ui:define>
</ui:composition>